package org.dbwebx.flex.module.project.events
{
	import flash.events.Event;
	import flash.utils.getQualifiedClassName;
	
	import mx.collections.ArrayCollection;
	
	import org.dbwebx.domain.Project;
	
	/**
	 * @author Izzet_Mustafayev
	 */
	public final class ProjectEvent extends Event
	{
		
		/**
		 * The add project event type.
		 */ 
		public static const ADD:String = getQualifiedClassName(ProjectEvent)+".ADD.Event";
		
		/**
		 * The project list loaded event type.
		 */ 
		public static const LIST_LOADED:String = getQualifiedClassName(ProjectEvent)+".LIST_LOADED.Event";
		
		/**
		 * The project list load required event type.
		 */ 
		public static const LOAD_LIST:String = getQualifiedClassName(ProjectEvent)+".LOAD_LIST.Event";
		
		/**
		 * The project list change event type.
		 */ 
		public static const LIST_CHANGE:String = getQualifiedClassName(ProjectEvent)+".LIST_CHANGE.Event";
		
		/**
		 * The Project instance.
		 */ 
		private var _project:Project;
		
		private var _projects:ArrayCollection;
		
		/**
		 * Creates project specific event. By default ADD event.
		 */ 
		public function ProjectEvent(eventType:String, project:Project=null):void
		{
			super(eventType, true, true);
			if(null != project){
				this._project = project;
			}
		}
		
		public function set project(project:Project):void
		{
			_project = project;
		}
		
		public function get project():Project
		{
			return _project;
		}
		
		public function set projects(projects:ArrayCollection):void
		{
			_projects = projects;
		}
		
		public function get projects():ArrayCollection
		{
			return _projects;
		}

	}
}